# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=gnome-remote-desktop
pkgver=0.1.8
pkgrel=0
pkgdesc="GNOME Remote Desktop - remove desktop server"
url="https://gitlab.gnome.org/jadahl/gnome-remote-desktop"
arch="all"
license="GPL-2.0-or-later"
makedepends="meson glib-dev pipewire-dev elogind-dev libsecret-dev libnotify-dev
	libvncserver-dev"
checkdepends="bash xvfb-run dbus py3-dbus py3-gobject3 mutter gnome-settings-daemon
	mesa-dri-gallium adwaita-icon-theme"
options="!check" # Needs a full fat GNOME session
source="https://gitlab.gnome.org/jadahl/gnome-remote-desktop/-/archive/$pkgver/gnome-remote-desktop-$pkgver.tar.gz"

prepare() {
	default_prepare

	# We don't need systemd services...
	sed '/systemd_dep/d' -i meson.build
	# Fix Bash location
	sed 's|usr/bin/bash|bin/bash|' -i tests/vnc-test-runner.sh
}

build() {
	meson \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--buildtype=plain \
		-Dsystemd_user_unit_dir=DELETEME \
		. output
	ninja -C output
}

check() {
	mkdir -p /tmp/runtimedir
	GSETTINGS_SCHEMA_DIR=output/src/ XDG_RUNTIME_DIR=/tmp/runtimedir ninja -C output test
}

package() {
	DESTDIR="$pkgdir" ninja -C output install
	rm -rf "$pkgdir"/usr/DELETEME
}

sha512sums="bcd114e3f533d5421deb0f75f4ff3202491e75490ba95c70b75506390d5061565d4add77a84c2d1edd42dcf840003a906a5aca534dfc804e6dc0ba53e9d0791d  gnome-remote-desktop-0.1.8.tar.gz"
